
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="Python">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>decorators module &#8212; deepaugment 0.2.0 documentation</title>
    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/language_data.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="module-decorators">
<span id="decorators-module"></span><h1>decorators module<a class="headerlink" href="#module-decorators" title="Permalink to this headline">¶</a></h1>
<p>Module consists decorators for helping other functions of the project</p>
<p>Decorators are arranged into following categories:</p>
<blockquote>
<div><ol class="arabic simple">
<li><dl class="first docutils">
<dt>Decorator decorators:</dt>
<dd>Those augment capabilites of other decorators
Medics</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>Reporters:</dt>
<dd>Those print or log information about functions</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>Middlemen:</dt>
<dd>Those manipulate information entering to (arguments) and/or
exiting from (returns) functions.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>Watchmen:</dt>
<dd>Those check information entering to and exiting from functions.
If they see an argument and/or return not obeying to rules,
throw exception.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>Classy-men:</dt>
<dd>They decorate classes fashionably</dd>
</dl>
</li>
</ol>
</div></blockquote>
<dl class="class">
<dt id="decorators.Reporter">
<em class="property">class </em><code class="descclassname">decorators.</code><code class="descname">Reporter</code><a class="reference internal" href="_modules/decorators.html#Reporter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.Reporter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Reporter class keeps decorators gives information about functions without intervening to them.</p>
<p>They are designed to be used safely with functions without worrying about if they will
affect the inner working of a function. They don't touch to functions, only reports.</p>
<dl class="staticmethod">
<dt id="decorators.Reporter.counter">
<em class="property">static </em><code class="descname">counter</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#Reporter.counter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.Reporter.counter" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator counts and logs number of times the function it decorates has been called.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="decorators.Reporter.logger">
<em class="property">static </em><code class="descname">logger</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#Reporter.logger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.Reporter.logger" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="staticmethod">
<dt id="decorators.Reporter.matrix_gossiper">
<em class="property">static </em><code class="descname">matrix_gossiper</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#Reporter.matrix_gossiper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.Reporter.matrix_gossiper" title="Permalink to this definition">¶</a></dt>
<dd><p>Gossips about the input matrices of the function it decorates.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="decorators.Reporter.timer">
<em class="property">static </em><code class="descname">timer</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#Reporter.timer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.Reporter.timer" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator prints running time of the function it decorates.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="decorators.check_df_arg_nonempty">
<code class="descclassname">decorators.</code><code class="descname">check_df_arg_nonempty</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#check_df_arg_nonempty"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.check_df_arg_nonempty" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator checks if the DataFrame arguments of the decorated function is not empty</p>
<p>It throws error and messages the user: if any of the argument who is a DataFrame is empty;
or if no DataFrame was given</p>
</dd></dl>

<dl class="function">
<dt id="decorators.check_df_arg_nonempty_at">
<code class="descclassname">decorators.</code><code class="descname">check_df_arg_nonempty_at</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#check_df_arg_nonempty_at"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.check_df_arg_nonempty_at" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="decorators.decorator_with_argumets">
<code class="descclassname">decorators.</code><code class="descname">decorator_with_argumets</code><span class="sig-paren">(</span><em>decorator</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#decorator_with_argumets"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.decorator_with_argumets" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator of decorator allows the decorator it decorates to accept arbitrary
number of arguments.</p>
<p>It also allows the decorator to be used without arguments. Possible ways
of calling the (decorated) decorator are:</p>
<blockquote>
<div><ol class="arabic simple">
<li>&#64;decorator()</li>
<li>&#64;decorator(&lt;args&gt;)</li>
</ol>
</div></blockquote>
<p>However, (decorated) decorator cannot be called without parantheses (e.g. &#64;decorator)</p>
</dd></dl>

<dl class="function">
<dt id="decorators.multi_element_argument">
<code class="descclassname">decorators.</code><code class="descname">multi_element_argument</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#multi_element_argument"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.multi_element_argument" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator allows the function it decorates to work with multiple element first argument.</p>
<p>If the first argument is a multi element type (such as list, tuple, set, or
np.array), decorated function works multiple times for each, and its returnings
are finally returned as a list.</p>
<p>If the first argument is a single element type, decorated function works as usual.</p>
</dd></dl>

<dl class="function">
<dt id="decorators.singleton">
<code class="descclassname">decorators.</code><code class="descname">singleton</code><span class="sig-paren">(</span><em>cls</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/decorators.html#singleton"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#decorators.singleton" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator makes sure the class it is decorating wont
be instantiated more than once</p>
<dl class="docutils">
<dt>A usage example:</dt>
<dd><p class="first">&#64;singleton
class AnyClass:</p>
<blockquote class="last">
<div>...</div></blockquote>
</dd>
</dl>
<p>If/when the class called for second time, previous (single)
instance will be returned</p>
<p>Inspiration of the decorator comes from:
<a class="reference external" href="https://www.python.org/dev/peps/pep-0318/#examples">https://www.python.org/dev/peps/pep-0318/#examples</a></p>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">deepaugment</a></h1>








<h3>Navigation</h3>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2019, Baris Ozmen.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.8.3</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="_sources/lib.decorators.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>